package com.gitee.llj.tools.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>web工具类</p>
 *
 * @Author llj
 * @Date 2018/5/16
 */
public class WebUtils {

    /**
     * 判断是不是异步请求
     * @param request
     * @return
     */
    public static boolean isAjaxRequest(HttpServletRequest request) {
        String requestedWith = request.getHeader("x-requested-with");
        if (requestedWith != null && requestedWith.equalsIgnoreCase("XMLHttpRequest")) {
            return true;
        } else {
            return false;
        }
    }
}
